global root "/Volumes/Workgroup/Lab/Lab-heimb/Montenovo/Volunteering Paper/Data"
global results "$root/07_results/RR/main"
global dictionaries "$root/Dictionaries"

cd "$dictionaries"
capture log close
log using graphtaxprice, replace


cd "$root"



use appended_analytic_010305111719, clear 

gen c=1

bysort unique_id_crossys: egen sumc=sum(c)

tab sumc

keep if sumc==6

replace taxable_inc_hh_gen=taxable_inc_hh_gen*100000

gen income_class=0 if taxable_inc_hh_gen>0 & taxable_inc_hh_gen<50000
replace income_class=1 if taxable_inc_hh_gen>=50000 & taxable_inc_hh_gen<100000
replace income_class=2 if taxable_inc_hh_gen>=100000 & taxable_inc_hh_gen<200000
replace income_class=3 if taxable_inc_hh_gen>=200000 & taxable_inc_hh_gen<500000
replace income_class=4 if taxable_inc_hh_gen>=500000 

count if income_class==.
tab taxable_inc_hh_gen if income_class==.
drop if income_class==.

gen itemized=0
replace itemized=1 if whether_itemized==1 // OR if deductions_allowed>0

//collapse (mean) taxprice, by(year)
collapse (mean) taxprice, by(year income_class)
//collapse (mean) total_giving, by(year income_class itemized)

//tab income_class total_giving if itemized==1
//twoway line taxprice year, ytitle("Tax Price") xtitle("Year")


twoway line taxprice year if income_class==0 || line taxprice year if income_class==1 || line taxprice year if income_class==2 || line taxprice year if income_class==3 || line taxprice year if income_class==4, legend(label(1 "$1-$49,999") label(2 "$50,000-$99,999") label(3 "$100,000-$199,999") label(4 "$200,000-$499,999") label(5 "$500,000 and more")) ytitle("Tax Price") xtitle("Year")
cd "$results"
graph export  taxprice_overtime_income.png, replace

///////////////////////////////////////////////////////////////////////////////

cd "$root"
use appended_analytic_010305111719, clear 

gen c=1

bysort unique_id_crossys: egen sumc=sum(c)

tab sumc

keep if sumc==6

gen itemized=0
replace itemized=1 if whether_itemized==1 // OR if deductions_allowed>0

//collapse (mean) taxprice, by(year)
collapse (mean) taxprice, by(year)
//collapse (mean) total_giving, by(year income_class itemized)

//tab income_class total_giving if itemized==1
//twoway line taxprice year, ytitle("Tax Price") xtitle("Year")


twoway line taxprice year, ytitle("Tax Price") xtitle("Year")
cd "$results"
graph export  taxprice_overtime.png, replace

cd "$dictionaries"
log close
